package com.example.javaairportflightanalysis.controller;

import com.example.javaairportflightanalysis.common.ApiRestResponse;
import com.example.javaairportflightanalysis.service.HomePageService;
import com.github.pagehelper.PageInfo;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/homepage")
public class HomePageController {
    @Resource
    HomePageService homePageService;
    @GetMapping("/homePageAList")
    public ApiRestResponse homePageAList(Integer pageNum, Integer pageSize) throws Exception {
        PageInfo pageInfo = homePageService.homePageAList(pageNum, pageSize);
        return ApiRestResponse.success(pageInfo);
    }
    @GetMapping("/homePageDList")
    public ApiRestResponse homePageDList(Integer pageNum, Integer pageSize) throws Exception {
        PageInfo pageInfo = homePageService.homePageDList(pageNum, pageSize);
        return ApiRestResponse.success(pageInfo);
    }
    @GetMapping("/homePageTransferListA")
    public ApiRestResponse homePageTransferListA(Integer pageNum, Integer pageSize) throws Exception {
        PageInfo pageInfo = homePageService.homePageTransferListA(pageNum, pageSize);
        return ApiRestResponse.success(pageInfo);
    }
    @GetMapping("/homePageTransferListD")
    public ApiRestResponse homePageTransferListD(Integer pageNum, Integer pageSize) throws Exception {
        PageInfo pageInfo = homePageService.homePageTransferListD(pageNum, pageSize);
        return ApiRestResponse.success(pageInfo);
    }
    @GetMapping("/selectHomePageA")
    public ApiRestResponse selectHomePageA(String dfltFlno, String dtime,  Integer pageNum, Integer pageSize) throws Exception {
        PageInfo pageInfo = homePageService.selectHomePageA(dfltFlno,dtime,pageNum,pageSize);
        return ApiRestResponse.success(pageInfo);
    }
    @GetMapping("/selectHomePageD")
    public ApiRestResponse selectHomePageD(String dfltFlno, String dtime,  Integer pageNum, Integer pageSize) throws Exception {
        PageInfo pageInfo = homePageService.selectHomePageD(dfltFlno,dtime,pageNum,pageSize);
        return ApiRestResponse.success(pageInfo);
    }
    @GetMapping("/selectHomePageTransferA")
    public ApiRestResponse selectHomePageTransferA(String dfltFlno, String dtime,  Integer pageNum, Integer pageSize) throws Exception {
        PageInfo pageInfo = homePageService.selectHomepageTransferA(dfltFlno,dtime,pageNum,pageSize);
        return ApiRestResponse.success(pageInfo);
    }
    @GetMapping("/selectHomePageTransferD")
    public ApiRestResponse selectHomePageTransferD(String dfltFlno, String dtime,  Integer pageNum, Integer pageSize) throws Exception {
        PageInfo pageInfo = homePageService.selectHomePageTransferD(dfltFlno,dtime,pageNum,pageSize);
        return ApiRestResponse.success(pageInfo);
    }
}
